using System;
using System.Collections.Generic;
using System.Text;
using System.Web.UI.Design;

namespace Acms.DataControls
{
    public class GenericDataSourceDesignerView<Item> : DesignerDataSourceView
    {
        public GenericDataSourceDesignerView(GenericDataSourceDesigner<Item> owner, string viewName):base(owner, viewName)
        {
            this.owner = owner;
        }

        GenericDataSourceDesigner<Item> owner;

        public override IDataSourceViewSchema Schema
        {
            get
            {
                TypeSchema ts = new TypeSchema(typeof(Item));
                return ts.GetViews()[0];
            }
        }

        public override bool CanDelete
        {
            get
            {
                return owner.CanDelete;
            }
        }

        public override bool CanInsert
        {
            get
            {
                return owner.CanInsert;
            }
        }

        public override bool CanPage
        {
            get
            {
                return owner.CanPage;
            }
        }

        public override bool CanRetrieveTotalRowCount
        {
            get
            {
                return owner.CanRetrieveTotalRowCount;
            }
        }

        public override bool CanSort
        {
            get
            {
                return owner.CanSort;
            }
        }

        public override bool CanUpdate
        {
            get
            {
                return owner.CanUpdate;
            }
        }

        public override System.Collections.IEnumerable GetDesignTimeData(int minimumRows, out bool isSampleData)
        {
            return owner.GetDesignTimeData(minimumRows, out isSampleData);
        }
    }
}
